#include <stdio.h>
#include "filefrag.h"

int main(){
    struct fiemap_extent* extents; //store extents of file
    unsigned long long filesize;

    //int num_extent = get_extent("/home/nvme/10G.txt",&extents);
    int num_extent = get_extent("../../Cosmos-plus-OpenSSD-master.zip",&extents,&filesize);

    printf("num_extent : %d\nfile size:%lld\n",num_extent,filesize);

    //print extent information
    for(int i=0;i<num_extent;i++){
        printf("%d th extent\n",i);
        printf("\tfe_logical : %llu\n",extents[i].fe_logical);
        printf("\tfe_physical : %llu\n",extents[i].fe_physical);
        printf("\tfe_length : %llu\n",extents[i].fe_length);
        printf("\tfe_flags : %d\n",extents[i].fe_flags);
    }

    free(extents);

    return 0;
}